package sqlserver;

import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.sql.Connection;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class Pro30015 {
	public static void main(String[] args) throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");
		//标准库
		Connection srcConn = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.184.155:1521:orcl", "PRO30015", "eplugger");
		//补充库
		Connection tarConn = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.59.103:49164:xe", "PRO30015", "eplugger");
		try {
			DBInfo srcInfo = new DBInfo(srcConn, "PRO30015", DBName.Oracle);
			DBInfo tarInfo = new DBInfo(tarConn, "PRO30015", DBName.Oracle);
			FileOutputStream fos = new FileOutputStream("/Users/firefly/Desktop/cp.sql");
			OutputStreamWriter osw = new OutputStreamWriter(fos);
//			DBUtils.compareDB(srcInfo, tarInfo, osw,false);
			String[] compareTables = new String[]{"biz_cfg_scene",
			"biz_cfg_edit_table",
			"biz_cfg_export",
			"biz_cfg_form",
			"biz_cfg_stat",
			"biz_cfg_table",
			"cfg_category",
			"cfg_category_entry",
			"sys_authority",
			"sys_business_filter",
			"sys_business_filter_result",
			"sys_entity_meta",
			"sys_group",
			"sys_group_menu_roles",
			"sys_menu",
			"sys_subsystem"};
			DBUtils.compareData(srcInfo, tarInfo,compareTables, osw, true);
		} finally{
			srcConn.close();
		}
	}
}
